﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style x:Key="MetroCalendarDayButtonStyle"
           TargetType="{x:Type CalendarDayButton}">
        <Setter Property="MinWidth"
                Value="5" />
        <Setter Property="MinHeight"
                Value="5" />
        <Setter Property="FontSize"
                Value="{DynamicResource ContentFontSize}" />
        <Setter Property="FontFamily"
                Value="{DynamicResource ContentFontFamily}" />
        <Setter Property="HorizontalContentAlignment"
                Value="Center" />
        <Setter Property="VerticalContentAlignment"
                Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type CalendarDayButton}">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         To="0.5"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Storyboard.TargetName="HighlightBackground" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         To="0.5"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Storyboard.TargetName="HighlightBackground" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         To="0"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Storyboard.TargetName="HighlightBackground" />
                                        <DoubleAnimation Duration="0"
                                                         To=".35"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Storyboard.TargetName="NormalText" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ActiveStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Active" />
                                <VisualState x:Name="Inactive">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="NormalText"
                                                                       Storyboard.TargetProperty="(TextElement.Foreground)">
                                            <DiscreteObjectKeyFrame Value="{DynamicResource GrayBrush2}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="BlackoutDayStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="NormalDay" />
                                <VisualState x:Name="BlackoutDay">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         To="1"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Storyboard.TargetName="Blackout" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Rectangle x:Name="TodayBackground"
                                   Fill="{DynamicResource AccentColorBrush}"
                                   Opacity="0" />
                        <Rectangle x:Name="SelectedBackground"
                                   Fill="{DynamicResource AccentColorBrush4}"
                                   Opacity="0" />
                        <Border BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Background="{TemplateBinding Background}" />
                        <Rectangle x:Name="HighlightBackground"
                                   Opacity="0"
                                   Fill="{DynamicResource AccentColorBrush4}" />
                        <Path x:Name="Blackout"
                              Data="M8.1772461,11.029181 L10.433105,11.029181 L11.700684,12.801641 L12.973633,11.029181 L15.191895,11.029181 L12.844727,13.999395 L15.21875,17.060919 L12.962891,17.060919 L11.673828,15.256231 L10.352539,17.060919 L8.1396484,17.060919 L10.519043,14.042364 z"
                              HorizontalAlignment="Stretch"
                              Margin="3"
                              Opacity="0"
                              RenderTransformOrigin="0.5,0.5"
                              Stretch="Fill"
                              VerticalAlignment="Stretch"
                              Fill="{DynamicResource AccentColorBrush3}" />
                        <ContentPresenter x:Name="NormalText"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          Margin="5,1,5,1"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          TextElement.Foreground="{DynamicResource GrayBrush1}" />
                        <Rectangle x:Name="DayButtonFocusVisual"
                                   IsHitTestVisible="false"
                                   Visibility="Collapsed"
                                   Stroke="{DynamicResource AccentColorBrush3}" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsToday"
                                           Value="False" />
                                <Condition Property="IsSelected"
                                           Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="NormalText"
                                    Property="TextElement.Foreground"
                                    Value="{DynamicResource AccentColorBrush}" />
                            <Setter TargetName="DayButtonFocusVisual"
                                    Property="Visibility"
                                    Value="Visible" />
                        </MultiTrigger>
                        <Trigger Property="IsToday"
                                 Value="True">
                            <Setter TargetName="TodayBackground"
                                    Property="Opacity"
                                    Value="1" />
                            <Setter TargetName="NormalText"
                                    Property="TextElement.Foreground"
                                    Value="{DynamicResource AccentSelectedColorBrush}" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsToday"
                                           Value="True" />
                                <Condition Property="IsBlackedOut"
                                           Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="TodayBackground"
                                    Property="Opacity"
                                    Value="0.5" />
                            <Setter TargetName="Blackout"
                                    Property="Fill"
                                    Value="{DynamicResource AccentColorBrush}" />
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="MetroCalendarItemStyle"
           TargetType="{x:Type CalendarItem}">
        <Setter Property="Margin"
                Value="0,3,0,3" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type CalendarItem}">
                    <ControlTemplate.Resources>
                        <!-- Used for day names-->
                        <DataTemplate x:Key="{x:Static CalendarItem.DayTitleTemplateResourceKey}">
                            <TextBlock Text="{Binding}"
                                       FontWeight="Bold"
                                       FontFamily="{DynamicResource ContentFontFamily}"
                                       FontSize="{DynamicResource ContentFontSize}"
                                       HorizontalAlignment="Center"
                                       VerticalAlignment="Center"
                                       Margin="0,6,0,6"
                                       Foreground="{DynamicResource BlackBrush}"
                                       Opacity="0.8" />
                        </DataTemplate>
                    </ControlTemplate.Resources>
                    <Grid x:Name="PART_Root">
                        <Grid.Resources>
                            <SolidColorBrush x:Key="DisabledColor"
                                             Color="#A5FFFFFF" />
                        </Grid.Resources>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         To="1"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Storyboard.TargetName="PART_DisabledVisual" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Border BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Background="{TemplateBinding Background}">
                            <Border BorderThickness="0">
                                <Grid Margin="2">
                                    <Grid.Resources>
                                        <ControlTemplate x:Key="PreviousButtonTemplate"
                                                         TargetType="{x:Type Button}">
                                            <Grid Cursor="Hand">
                                                <VisualStateManager.VisualStateGroups>
                                                    <VisualStateGroup x:Name="CommonStates">
                                                        <VisualState x:Name="Normal" />
                                                        <VisualState x:Name="MouseOver">
                                                            <Storyboard>
                                                                <DoubleAnimation Duration="0"
                                                                                 To="1"
                                                                                 Storyboard.TargetProperty="Opacity"
                                                                                 Storyboard.TargetName="path" />
                                                            </Storyboard>
                                                        </VisualState>
                                                        <VisualState x:Name="Disabled">
                                                            <Storyboard>
                                                                <DoubleAnimation Duration="0"
                                                                                 To=".5"
                                                                                 Storyboard.TargetProperty="Opacity"
                                                                                 Storyboard.TargetName="path" />
                                                            </Storyboard>
                                                        </VisualState>
                                                    </VisualStateGroup>
                                                </VisualStateManager.VisualStateGroups>
                                                <Rectangle Opacity="0.1"
                                                           Stretch="Fill"
                                                           Fill="{DynamicResource AccentColorBrush}" />
                                                <Path x:Name="path"
                                                      Data="M288.75,232.25 L288.75,240.625 L283,236.625 z"
                                                      Opacity="0.7"
                                                      Fill="white"
                                                      HorizontalAlignment="Left"
                                                      Height="10"
                                                      Margin="14,-6,0,0"
                                                      Stretch="Fill"
                                                      VerticalAlignment="Center"
                                                      Width="6" />
                                            </Grid>
                                        </ControlTemplate>
                                        <ControlTemplate x:Key="NextButtonTemplate"
                                                         TargetType="{x:Type Button}">
                                            <Grid Cursor="Hand">
                                                <VisualStateManager.VisualStateGroups>
                                                    <VisualStateGroup x:Name="CommonStates">
                                                        <VisualState x:Name="Normal" />
                                                        <VisualState x:Name="MouseOver">
                                                            <Storyboard>
                                                                <DoubleAnimation Duration="0"
                                                                                 To="1"
                                                                                 Storyboard.TargetProperty="Opacity"
                                                                                 Storyboard.TargetName="path" />
                                                            </Storyboard>
                                                        </VisualState>
                                                        <VisualState x:Name="Disabled">
                                                            <Storyboard>
                                                                <DoubleAnimation Duration="0"
                                                                                 To=".2"
                                                                                 Storyboard.TargetProperty="Opacity"
                                                                                 Storyboard.TargetName="path" />
                                                            </Storyboard>
                                                        </VisualState>
                                                    </VisualStateGroup>
                                                </VisualStateManager.VisualStateGroups>
                                                <Rectangle Opacity="0.1"
                                                           Stretch="Fill"
                                                           Fill="{DynamicResource AccentColorBrush}" />
                                                <Path x:Name="path"
                                                      Data="M282.875,231.875 L282.875,240.375 L288.625,236 z"
                                                      Opacity="0.7"
                                                      Fill="white"
                                                      HorizontalAlignment="Right"
                                                      Height="10"
                                                      Margin="0,-6,14,0"
                                                      Stretch="Fill"
                                                      VerticalAlignment="Center"
                                                      Width="6" />
                                            </Grid>
                                        </ControlTemplate>
                                        <ControlTemplate x:Key="HeaderButtonTemplate"
                                                         TargetType="{x:Type Button}">
                                            <Grid Cursor="Hand">
                                                <VisualStateManager.VisualStateGroups>
                                                    <VisualStateGroup x:Name="CommonStates">
                                                        <VisualState x:Name="Normal" />
                                                        <VisualState x:Name="MouseOver">
                                                            <Storyboard>
                                                                <DoubleAnimation Duration="0"
                                                                                 To="1"
                                                                                 Storyboard.TargetProperty="Opacity"
                                                                                 Storyboard.TargetName="buttonContent" />
                                                            </Storyboard>
                                                        </VisualState>
                                                        <VisualState x:Name="Disabled">
                                                            <Storyboard>
                                                                <DoubleAnimation Duration="0"
                                                                                 To=".5"
                                                                                 Storyboard.TargetProperty="Opacity"
                                                                                 Storyboard.TargetName="buttonContent" />
                                                            </Storyboard>
                                                        </VisualState>
                                                    </VisualStateGroup>
                                                </VisualStateManager.VisualStateGroups>
                                                <ContentPresenter x:Name="buttonContent"
                                                                  Opacity="0.7"
                                                                  ContentTemplate="{TemplateBinding ContentTemplate}"
                                                                  Content="{TemplateBinding Content}"
                                                                  Margin="1,4,1,9"
                                                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                                  TextElement.FontFamily="{DynamicResource ContentFontFamily}"
                                                                  TextElement.Foreground="{DynamicResource AccentSelectedColorBrush}" />
                                            </Grid>
                                        </ControlTemplate>

                                        <Style x:Key="PreviousCalendarButtonStyle"
                                               TargetType="{x:Type Button}">
                                            <Setter Property="Template"
                                                    Value="{StaticResource PreviousButtonTemplate}" />
                                        </Style>
                                        <Style x:Key="NextCalendarButtonStyle"
                                               TargetType="{x:Type Button}">
                                            <Setter Property="Template"
                                                    Value="{StaticResource NextButtonTemplate}" />
                                        </Style>
                                        <Style x:Key="HeaderCalendarButtonStyle"
                                               TargetType="{x:Type Button}">
                                            <Setter Property="Template"
                                                    Value="{StaticResource HeaderButtonTemplate}" />
                                        </Style>
                                    </Grid.Resources>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>

                                    <Grid Grid.Row="0"
                                          HorizontalAlignment="Stretch"
                                          Background="{DynamicResource AccentColorBrush}">
                                        <Button x:Name="PART_HeaderButton"
                                                FontWeight="Bold"
                                                FontFamily="{DynamicResource ContentFontFamily}"
                                                Focusable="False"
                                                FontSize="{DynamicResource ContentFontSize}"
                                                HorizontalAlignment="Center"
                                                Grid.Row="0"
                                                Style="{StaticResource HeaderCalendarButtonStyle}"
                                                VerticalAlignment="Center" />
                                        <Button x:Name="PART_PreviousButton"
                                                Focusable="False"
                                                HorizontalAlignment="Left"
                                                Height="20"
                                                Width="28"
                                                Grid.Row="0"
                                                Style="{StaticResource PreviousCalendarButtonStyle}" />
                                        <Button x:Name="PART_NextButton"
                                                Focusable="False"
                                                HorizontalAlignment="Right"
                                                Height="20"
                                                Width="28"
                                                Grid.Row="0"
                                                Style="{StaticResource NextCalendarButtonStyle}" />
                                    </Grid>
                                    <Grid x:Name="PART_MonthView"
                                          HorizontalAlignment="Stretch"
                                          VerticalAlignment="Stretch"
                                          Margin="6,-1,6,6"
                                          Grid.Row="1"
                                          Visibility="Visible">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="*" />
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="*" />
                                            <RowDefinition Height="*" />
                                            <RowDefinition Height="*" />
                                            <RowDefinition Height="*" />
                                            <RowDefinition Height="*" />
                                            <RowDefinition Height="*" />
                                            <RowDefinition Height="*" />
                                        </Grid.RowDefinitions>
                                    </Grid>
                                    <Grid x:Name="PART_YearView"
                                          HorizontalAlignment="Stretch"
                                          VerticalAlignment="Stretch"
                                          Margin="6,-3,7,6"
                                          Grid.Row="1"
                                          Visibility="Hidden">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="*" />
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="*" />
                                            <RowDefinition Height="*" />
                                            <RowDefinition Height="*" />
                                        </Grid.RowDefinitions>
                                    </Grid>
                                </Grid>
                            </Border>
                        </Border>
                        <Rectangle x:Name="PART_DisabledVisual"
                                   Fill="{StaticResource DisabledColor}"
                                   Opacity="0"
                                   Stretch="Fill"
                                   Stroke="{StaticResource DisabledColor}"
                                   StrokeThickness="1"
                                   Visibility="Collapsed" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled"
                                 Value="False">
                            <Setter Property="Visibility"
                                    TargetName="PART_DisabledVisual"
                                    Value="Visible" />
                        </Trigger>
                        <DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}"
                                     Value="Year">
                            <Setter Property="Visibility"
                                    TargetName="PART_MonthView"
                                    Value="Hidden" />
                            <Setter Property="Visibility"
                                    TargetName="PART_YearView"
                                    Value="Visible" />
                        </DataTrigger>
                        <DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}"
                                     Value="Decade">
                            <Setter Property="Visibility"
                                    TargetName="PART_MonthView"
                                    Value="Hidden" />
                            <Setter Property="Visibility"
                                    TargetName="PART_YearView"
                                    Value="Visible" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="MetroCalendarButtonStyle"
           TargetType="{x:Type CalendarButton}">
        <Setter Property="Background"
                Value="{DynamicResource AccentColorBrush4}" />
        <Setter Property="MinWidth"
                Value="40" />
        <Setter Property="MinHeight"
                Value="42" />
        <Setter Property="FontSize"
                Value="{DynamicResource ContentFontSize}" />
        <Setter Property="FontFamily"
                Value="{DynamicResource ContentFontFamily}" />
        <Setter Property="HorizontalContentAlignment"
                Value="Center" />
        <Setter Property="VerticalContentAlignment"
                Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type CalendarButton}">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         To=".5"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Storyboard.TargetName="Background" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         To=".5"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Storyboard.TargetName="Background" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Unselected" />
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         To=".75"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Storyboard.TargetName="SelectedBackground" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ActiveStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Active" />
                                <VisualState x:Name="Inactive">
                                    <Storyboard>

                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetName="NormalText"
                                                                       Storyboard.TargetProperty="(TextElement.Foreground)">
                                            <DiscreteObjectKeyFrame Value="{DynamicResource GrayBrush2}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CalendarButtonFocusStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="CalendarButtonFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetProperty="Visibility"
                                                                       Storyboard.TargetName="CalendarButtonFocusVisual">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="CalendarButtonUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                       Storyboard.TargetProperty="Visibility"
                                                                       Storyboard.TargetName="CalendarButtonFocusVisual">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Rectangle x:Name="SelectedBackground"
                                   Fill="{TemplateBinding Background}"
                                   Opacity="0" />
                        <Rectangle x:Name="Background"
                                   Fill="{TemplateBinding Background}"
                                   Opacity="0" />
                        <ContentPresenter x:Name="NormalText"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          Margin="1,0,1,1"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          TextElement.Foreground="{DynamicResource GrayBrush1}" />
                        <Rectangle x:Name="CalendarButtonFocusVisual"
                                   IsHitTestVisible="false"
                                   Visibility="Collapsed"
                                   Stroke="{DynamicResource AccentColorBrush3}" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsFocused"
                                 Value="True">
                            <Setter Property="Visibility"
                                    TargetName="CalendarButtonFocusVisual"
                                    Value="Visible" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="MetroCalendar"
           TargetType="{x:Type Calendar}">
        <Setter Property="SnapsToDevicePixels"
                Value="True" />
        <Setter Property="Foreground"
                Value="white" />
        <Setter Property="CalendarDayButtonStyle"
                Value="{DynamicResource MetroCalendarDayButtonStyle}" />
        <Setter Property="CalendarItemStyle"
                Value="{DynamicResource MetroCalendarItemStyle}" />
        <Setter Property="CalendarButtonStyle"
                Value="{DynamicResource MetroCalendarButtonStyle}" />
        <Setter Property="Background"
                Value="{DynamicResource WhiteBrush}" />
        <Setter Property="BorderBrush"
                Value="{DynamicResource BlackBrush}" />
        <Setter Property="BorderThickness"
                Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Calendar}">
                    <StackPanel x:Name="PART_Root"
                                HorizontalAlignment="Center"
                                Background="{DynamicResource WhiteBrush}">
                        <CalendarItem x:Name="PART_CalendarItem"
                                      BorderBrush="{TemplateBinding BorderBrush}"
                                      BorderThickness="{TemplateBinding BorderThickness}"
                                      Background="{TemplateBinding Background}"
                                      Style="{TemplateBinding CalendarItemStyle}" />
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>